#!/user/bin/env node
const cp = require('child_process');

console.log('i am ipc father pid:',process.pid);
let son = cp.fork('./11-ipc-child.js'),
    dua = cp.fork('./11-ipc-child.js');

son.on('message',(data)=>{
  console.log('son msg:',data);
});
dua.on('message',(msg)=>{
  console.log('dua msg:',msg);
});

setTimeout(()=>{
  son.send('son are peng');
  dua.send('dua good girl');
},2000);

setTimeout(()=>{
  son.kill('SIGINT');
  dua.kill('SIGINT');
  process.exit();
},6000);

